/****
Program for: Conscription and Military Service: Do They Result in Violent 
and Non-Violent Incarcerations and Recidivism?

This program computes the bounds on LNATE, LMATE, ATT, ATE, LATE 
1948-1952 white and nonwhite in the pooled survey year.

02/14/2019
***/ 
capture log close
***Install package: Distinct 
ssc inst distinct

*****Please replace here with the directory folder
cd "/Users/Xintong/Documents/Files for Apple/1952 birth cohort"

set more off
clear all
set memory 350m
set matsize 1000

program drop _all

global outcomes = "LScurrentViolent LSnonviolent EvercurrentViolent Evernonviolent"
global race4852= "0 1"

use pop_sample_03162020, clear 

keep weight yob Census birthYear white study id total_male_inmate /// 
birthMonth birthDay lott totalSample currentViolent nonviolent nonviolent_new vv eligible /// 
contactJuvenile violent_desistance nonviolent_desistance violent_r_draft nonviolent_r_draft ///
violent_drug_draft nonviolent_drug_draft ygroup* birth monthPop drawingYear APNheight ///
seasonYear seasonPop seasonYear_group seasonYear_group* monthYear_group monthYear_group* inmate /// 
fe_yob* fe_mob* fe_yobmob* yobmob lindo criminal violent nonviolent /// 
mob dob birth ygroup* fe_yob* yobmob fe_mob* drawingYear induction yobRSNID ///
relativeLotteryNumber relLotNumInteract relLotNumSquared relLotNumSqInter yeargroup ///
relLotNumCubed  relLotNumCuInter staylength yob lotteryNumber white study surveyyear LScurrentViolent LSnonviolent ///
LSviolent_desistance LSnonviolent_desistance LSviolent_r_draft LSnonviolent_r_draft LSviolent_drug_draft LSnonviolent_drug_draft ///
EvercurrentViolent Evernonviolent Everviolent_desistance Evernonviolent_desistance Everviolent_r_draft Evernonviolent_r_draft ///
 Everviolent_drug_draft Evernonviolent_drug_draft survey1 survey2 survey3 

qui do I2_pop_test_be_0804
qui do I2_pop_test_racial_be_0804

log using 1952_offense_log, text replace


foreach crime_outcome in $outcomes{

global outcome1="`crime_outcome'"

I2_pop_test_be

*Step 8: bootstrapping (uncomment to run the bootstrap)
   bootstrap _b, r(2500) str(Census) saving(vc_`crime_outcome'_ygroup5_white_nonwhite_test_I2_be.dta, double replace) seed(1989): I2_pop_test_be 
   display("program finished running")
   
   }
   
log close   
